// src/pages/Login.jsx
import { useState } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { FuiouButton } from '@/components/comm/FuiouButton';
export default function Login() {
  const [username, setUsername] = useState('');
  const [password, setPassword] = useState('');

  const navigate = useNavigate();
  const location = useLocation();

  // 获取登录前的路径（登录后返回原页面）
  const from = location.state?.from || '/home';

  const handleSubmit = (e) => {
    
    navigate("/index")
    console.log("这里被点击了")
    e.preventDefault();
  };

  return (
    <main className='comm-content flex align-items justify-content-center'>
        <section className='comm-login'>
            <h2 className='tit'>欢迎登录</h2>
            <ul className='pd-tb-30'>
                <li className='flex pd-b-20'>
                    <label className='label'>用户名：</label>
                    <div className='flex-1'>
                        <input className='inp w-100' value={username}  type="text" />
                    </div>
                </li>
                <li className='flex'>
                    <label className='label'>密码：</label>
                    <div className='flex-1'>
                        <input  className='inp w-100' value={password} type='password' />
                    </div>
                </li>
            </ul>
            <div className='flex pd-t-20'>
                <div className='pd-r-20 flex-1'>
                    <FuiouButton type="danger" onClick={()=>{}} block>取消</FuiouButton>
                </div>
                <div className='flex-1'>
                    <FuiouButton type="primary" disabled onClick={handleSubmit}  block>登录</FuiouButton>
                </div>
            </div>
        </section>
    </main>
  );
}